import { dayjs, cloneDeep, getRandomIntBetween } from "./utils";
import GroupLine from "@iconify-icons/ri/group-line";
import Shop from "@iconify-icons/ep/shop";
import Fires from "@iconify-icons/ep/fries";
import Guide from "@iconify-icons/ep/guide";

const days = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];

/** 总发货单数 总存货单数 总提货单数 入驻企业数 */
const chartData = [
  {
    icon: Shop,
    bgColor: "#effaff",
    color: "#41b6ff",
    duration: 2000,
    name: "总发货单数",
    value: 36000,
    percent: "+88%",
    data: [11, 11, 1, 11, 11, 11, 11] // 平滑折线图数据
  },
  {
    icon: Fires,
    bgColor: "#fff5f4",
    color: "#e85f33",
    duration: 1600,
    name: "总存货单数",
    value: 16580,
    percent: "+70%",
    data: [2216, 1148, 1255, 788, 4821, 1973, 4379]
  },
  {
    icon: Guide,
    bgColor: "#eff8f4",
    color: "#26ce83",
    duration: 1500,
    name: "总提货单数",
    value: 16499,
    percent: "+99%",
    data: [861, 1002, 3195, 1715, 3666, 2415, 3645]
  },
  {
    icon: GroupLine,
    bgColor: "#f6f4fe",
    color: "#7846e5",
    duration: 10,
    name: "入驻企业数",
    value: 120,
    percent: "+10%",
    data: [121, 222, 13, 444, 55, 66, 94]
  }
];

/** 分析概览 */
const barChartData = [
  {
    require1Data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    questionData: [13, 14, 15, 16, 17, 18, 19]
  },
  {
    require1Data: [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],
    questionData: [31, 32, 33, 34, 35, 36, 37]
  },
  {
    requireData: [
      1111, 1131, 500, 1111, 1111, 1111, 111, 111, 1111, 111, 1231, 111
    ],
    questionData: [2222, 2222, 2222, 222, 2222, 2232, 2222]
  }
];

/** 解决概率 */
const progressData = [
  {
    week: "周一",
    percentage: 85,
    duration: 110,
    color: "#41b6ff"
  },
  {
    week: "周二",
    percentage: 86,
    duration: 105,
    color: "#41b6ff"
  },
  {
    week: "周三",
    percentage: 88,
    duration: 100,
    color: "#41b6ff"
  },
  {
    week: "周四",
    percentage: 89,
    duration: 95,
    color: "#41b6ff"
  },
  {
    week: "周五",
    percentage: 94,
    duration: 90,
    color: "#26ce83"
  },
  {
    week: "周六",
    percentage: 96,
    duration: 85,
    color: "#26ce83"
  },
  {
    week: "周日",
    percentage: 100,
    duration: 80,
    color: "#26ce83"
  }
].reverse();

/** 数据统计 */
const tableData = Array.from({ length: 30 }).map((_, index) => {
  return {
    id: index + 1,
    requiredNumber: getRandomIntBetween(13500, 19999),
    questionNumber: getRandomIntBetween(12600, 16999),
    resolveNumber: getRandomIntBetween(13500, 17999),
    satisfaction: getRandomIntBetween(95, 100),
    date: dayjs().subtract(index, "day").format("YYYY-MM-DD")
  };
});

/** 最新动态 */
const latestNewsData = cloneDeep(tableData)
  .slice(0, 14)
  .map((item, index) => {
    return Object.assign(item, {
      date: `${dayjs().subtract(index, "day").format("YYYY-MM-DD")} ${
        days[dayjs().subtract(index, "day").day()]
      }`
    });
  });

export { chartData, barChartData, progressData, tableData, latestNewsData };
